-
Notifications
You must be signed in to change notification settings - Fork 136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wang frenkel #1970
base: trunk-minor
Are you sure you want to change the base?
Wang frenkel #1970
Conversation
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
Thanks. I'm busy right now but will review this when I get a chance. I would be helpful if you could address the failing CI checks. |
Failing test is the pre-commit.ci. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Regarding pre-commit: Yes -- you need to run pre-commit
, commit the automatic changes, and make any manual adjustments needed to satisfy all the lints. See https://hoomd-blue.readthedocs.io/en/v5.0.1/style.html
Overall, this PR is very clean and complete. Aside from pre-commit, I have a few questions and requests around the new pow math functions. I will be happy to merge after these are addressed and the needed unit test is added.
Co-authored-by: Joshua A. Anderson <[email protected]>
Co-authored-by: Joshua A. Anderson <[email protected]>
Should be more or less set now. There is a last detail, if users input negative mu or nu, the cast to uint in the evaluator fails (the exponent should always be positive for this potential to make sense anyway). The user receives a cryptic message: RuntimeError: Unable to cast Python instance of type <class 'int'> to C++ type '?' (#define PYBIND11_DETAILED_ERROR_MESSAGES or compile in debug mode for details) Python doesn't have built-in types for unsigned integers. I can check this on the C++ side, but that yields lengthy messages. Do we have a neater way on the python side? |
Yes, use a validator. We have one for positive reals, but not positive ints so you will need to write one: hoomd-blue/hoomd/data/typeconverter.py Lines 87 to 95 in 769ec59
Here is an example of how it gets used: hoomd-blue/hoomd/md/pair/pair.py Lines 328 to 332 in 769ec59
Using these will give a somewhat better formatted message indicating which parameter keys caused the error message. |
Description
This draft PR would add the Wang-Frenkel potential to hoomd (equation (2) in Wang & Frenkel, https://pubs.rsc.org/en/content/articlelanding/2020/cp/c9cp05445f).
Motivation and context
This is largely motivated by coarse-grained IDP models, specifically by MPIPI (https://www.nature.com/articles/s43588-021-00155-3), which uses this type of potential.
How has this been tested?
This is work in progress, unit tests will be added to hoomd. At the time of writing this draft PR, I would want some feedback on the implementation. Specifically, in eq (2) of Wang et al, the cutoff radius appears in the potential. I have chosen to change "r_c" there by an adjustable parameter.
As the potential requires calculation of arbitrary powers, which are integers, this has required addition of pow(float, int) in hoomdmath.
Checklist:
sphinx-doc/credits.rst
) in the pull request source branch.CHANGELOG.rst
following the established format.